#ifndef SERVER_H
#define SERVER_H SERVER_H

#define MAXCLIENTS 1
#include <stdio.h>
#include <unistd.h>

/* Client structure */
typedef struct
{
  int  sockfd;
  char ipaddr[32];
} client_t;

/* Server Info structure */
typedef struct
{
  int started;
  int sockfd;
  client_t clients[MAXCLIENTS];
  int num_of_clients;
} server_info_t;

/* Read "n" bytes from a descriptor. */
ssize_t readn(int fd, void *vptr, size_t n);

/* Write "n" bytes to a descriptor. */
ssize_t writen(int fd, const void *vptr, size_t n);

int start_server(int port);
server_info_t get_serverinfo(void);
int stop_server(void);

#endif
